
#include "lightningbeambullet.h"
#include "resourcemanager.h"
#include "gamemanager.h"
#include "army.h"
#include "unit.h"

#define __super         Bullet

static const float BULLET_SPEED = 2000.0f;

LightningBeamBullet::LightningBeamBullet(int lineIndex, Army* ourArmy, Army* theirArmy, EquipmentAttribute* attr) :
__super(attr)
, _ourArmy(nullptr)
, _theirArmy(nullptr)
, rowIndex(0)
, velocity(ccp(BULLET_SPEED, 0))
{
	ArmyFaction faction = ArmyFaction::left;
	for(Unit* unit : ourArmy->soldiers[lineIndex]) {
		if(unit) {
			src = unit->position;
			faction = unit->faction;
		}
	}

	if(faction == ArmyFaction::left) {
		dst = ccp(GM->screenSize.width - FORMATION_MARGIN, src.y);
	} else {
		dst = ccp(FORMATION_MARGIN, src.y);
		velocity.x = -velocity.x;
	}

	position = src;
}

LightningBeamBullet::~LightningBeamBullet() {
}

void LightningBeamBullet::init() {
	__super::init();

}

bool LightningBeamBullet::update(float ticks) {
	bool ret = true;


	return ret;
}
